﻿using System;
using System.Threading;

namespace Chapter1_4
{
    public class Program
    {
    
        public static void Main(string[] args)
        {
            bool Stoped = false;
            Thread t = new Thread(new ThreadStart(() => {
                while (!Stoped)
                {
                    Console.WriteLine("Running...");
                    Thread.Sleep(1000);
                }
            }));

            t.Start();
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
            Stoped = true;
            t.Join(); 

        }
    }
}
